package main

import (
	"fmt"
	"time"
)

func main() {
	now := time.Now() //获取一个日期时间对象
	fmt.Printf("当前时间: %v ，数据类型是：%T \n", now, now)

	year := now.Year()
	month := now.Month()
	day := now.Day()       //日
	hour := now.Hour()     //小时
	minute := now.Minute() //分钟
	second := now.Second() //秒

	fmt.Printf("格式化后的时间： %d-%02d-%02d %02d:%02d:%02d \n", year, month, day, hour, minute, second)
}
